import string
import time
#Python的内置字符串对象
print('string 内置对象')
print(string.ascii_letters)
print(string.digits)


#多行字符串
print('多行字符串')
str3='''
{"success":true,"code":1,"message":"success","result":{"orderId":"77879268014555136","outOrderId":"ja202405094654092059313235089","mid":161,"mname":"权益商城卡密商品-SUP","rechargeAccount":"17602903226","markPrice":100,"quantity":1,"price":1000,"amount":1000,"state":0,"orderTime":"2024-05-09 14:57:37","cards":null}}
'''
print(str3)

#字符串拼接
print("字符串拼接")
str4="hello"+" "+"world"
str4="abc" "def" "ghi"
print(str4)

#字符串重复三次
str5="hello" * 3
print('"hello" * 3'+" "+ str5)

#字符串切片
str6="hello world!"
print(str6[0:3])
#最后一个
print(str6[-1])

#字符串查找
str_text="hello world!"
print(str_text.find("world"))

#字符串替换
str_text="hello world!"
print(str_text.replace("world","python"))

#字符串去空格
str_text="  hello world! "
print(str_text.strip())

#字符串格式化
print("字符串格式化")
name="zhangsan"
age=20
text="name:%s,age:%d"%(name,age)
print(text)
#字符串格式化

print("name:{},age:{}".format(name,age))
print(f"name:{name},age:{age}")

#字符串编码与解码
print("编码与解码")
str_text="hello world!"
print(str_text.encode())
print(str_text.encode().decode())
str_text="编码与解码!"
print(str_text.encode())
print(str_text.encode().decode())






